package com.swgk.core.util;

import android.text.TextUtils;

import com.swgk.core.util.SharedPreferenceUtil;

/**
 * @author: 杨畔
 * @date: 2021/7/27 09:58
 * @Description: 菜单权限判断工具类
 */
public class PermissionCheckUtil {
    //------货源管理权限-------
    public static final String KEY_HUOYUANGUANLI = "19_huoyuanguanli";//货源管理权限
    public static final String KEY_WODEXUNJIA = "19_wodexunjia";//询价权限
    public static final String KEY_CHENGYUNSHANGJI = "19_chengyunshangji";//承运权限
    //------会员-------
    public static final String KEY_YAOQINGGUANLI = "14_yaoqingguanli";//邀请管理
    //我的报价/接单权限（车主报价）
    public static final String KEY_CHEZHUBAOJIA = "22_chezhubaojia";//车主报价

    /**
     * 检查是否有公司某权限
     */
    public static boolean hasCompanyPermission(String checkPermission) {
        String permission = "";
        if (UserOperating.getInstance().isCompany()) {
            permission = SharedPreferenceUtil.getInstance().getSaveStringData(SharedPreferenceUtil.IS_DATA, "");
        }
        return !TextUtils.isEmpty(permission) && permission.contains(checkPermission);
    }
}
